import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import net.sf.json.JSONObject;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.junit.Test;

import java.util.Arrays;
import java.util.List;
public class java {
    @Test
    public static void main(String[] args){
        test2();
    }
    private static void test2() {
//        String jsonStr = 	"[{fd_3c460e560fc7a8=0, fd_3c460e6bfc35b4=null, fd_3c460e6cca7ac6=null, fd_3c460e5706d522_record=[{data=不检测, name=管理员, time=Mon Oct 09 13:58:29 CST 2023, id=1183b0b84ee4f581bba001c47a78b2d9}], fd_3c4555eddaf464_selectedDatas=, fd_3c460e7171bed8=null, fd_3c460e7014c014=null, fd_3c4555eddaf464_dataFdId=, fd_3c460e5706d522=0, fd_3c4555e6f071ce_text=SOWL2107010001, fd_3c4555e6f071ce_selectedDatas=, fd_3c460e6f8c059c=null, fd_3c460e57839744_record=[{data=不检测, name=管理员, time=Mon Oct 09 13:58:29 CST 2023, id=1183b0b84ee4f581bba001c47a78b2d9}], fd_3c3ffcbd979d92_record=[{data=1, name=管理员, time=Mon Oct 09 13:58:29 CST 2023, id=1183b0b84ee4f581bba001c47a78b2d9}], fd_3c4555eddaf464=ibox, fd_3c460e6d98f1e0=null, fdId=18b1303fad1369311727cbb4cb892a25, fd_3c460e7088a848=null, fd_3c460e6e7e24ca=null, fd_3c3ffcbc4327b2=物联锁展示柜,组装好的,包含2个物联锁+1个有线控制器+2个数显触摸屏+四个阻尼铰链+1个拉手+其他配件+1套柜体, fd_3c460e57f8e99c_record=[{data=不检测, name=管理员, time=Mon Oct 09 13:58:29 CST 2023, id=1183b0b84ee4f581bba001c47a78b2d9}], fd_3c460dbdb47274=0, fd_3c460e560fc7a8_record=[{data=不检测, name=管理员, time=Mon Oct 09 13:58:29 CST 2023, id=1183b0b84ee4f581bba001c47a78b2d9}], fd_3c4555e6f071ce_dataModelName=, fd_3c460e6dff18b6=null, fd_3c460e6f095840=null, fd_3c3ffcbc4327b2_record=[{data=物联锁展示柜,组装好的,包含2个物联锁+1个有线控制器+2个数显触摸屏+四个阻尼铰链+1个拉手+其他配件+1套柜体, name=管理员, time=Mon Oct 09 13:58:29 CST 2023, id=1183b0b84ee4f581bba001c47a78b2d9}], fd_3c460e6c6f0882=null, fd_3c460e71f46a90=null, fd_3c4555eddaf464_dataModelName=, fd_3c4555eddaf464_text=ibox-1580, fd_3c460e5693543e_record=[{data=不检测, name=管理员, time=Mon Oct 09 13:58:29 CST 2023, id=1183b0b84ee4f581bba001c47a78b2d9}], fd_3c3ffcbd979d92=1, fd_3c460e57839744=0, fd_3c460e57f8e99c=0, fd_3c4555e6f071ce_dataFdId=, fd_3c460e5693543e=0, fd_3c4555e6f071ce=SOWL2107010001, fd_3c460dbdb47274_record=[{data=不检测, name=管理员, time=Mon Oct 09 13:58:29 CST 2023, id=1183b0b84ee4f581bba001c47a78b2d9}], fd_3c460e6d3e8382=null, fd_3c4555e6f071ce_dataSourceId=, fd_3c4555eddaf464_dataSourceId=, fd_3c460e70fb65ac=null}, {fd_3c460e560fc7a8=1, fd_3c460e6bfc35b4=null, fd_3c460e6cca7ac6=null, fd_3c460e5706d522_record=[{data=检测, name=管理员, time=Mon Oct 09 13:58:29 CST 2023, id=1183b0b84ee4f581bba001c47a78b2d9}], fd_3c4555eddaf464_selectedDatas=, fd_3c460e7171bed8=null, fd_3c460e7014c014=null, fd_3c4555eddaf464_dataFdId=, fd_3c460e5706d522=1, fd_3c4555e6f071ce_text=SOYP2310090002, fd_3c4555e6f071ce_selectedDatas=, fd_3c460e6f8c059c=null, fd_3c460e57839744_record=[{data=检测, name=管理员, time=Mon Oct 09 13:58:29 CST 2023, id=1183b0b84ee4f581bba001c47a78b2d9}], fd_3c3ffcbd979d92_record=[{data=1, name=管理员, time=Mon Oct 09 13:58:29 CST 2023, id=1183b0b84ee4f581bba001c47a78b2d9}], fd_3c4555eddaf464=XS1507, fd_3c460e6d98f1e0=null, fdId=18b1303fad1fb10393afeac4d8a8ae81, fd_3c460e7088a848=null, fd_3c460e6e7e24ca=null, fd_3c3ffcbc4327b2=1507外带主控线束(网卡),多种,与控制器对接(外协整条采购), fd_3c460e57f8e99c_record=[{data=检测, name=管理员, time=Mon Oct 09 13:58:29 CST 2023, id=1183b0b84ee4f581bba001c47a78b2d9}], fd_3c460dbdb47274=1, fd_3c460e560fc7a8_record=[{data=检测, name=管理员, time=Mon Oct 09 13:58:29 CST 2023, id=1183b0b84ee4f581bba001c47a78b2d9}], fd_3c4555e6f071ce_dataModelName=, fd_3c460e6dff18b6=null, fd_3c460e6f095840=null, fd_3c3ffcbc4327b2_record=[{data=1507外带主控线束(网卡),多种,与控制器对接(外协整条采购), name=管理员, time=Mon Oct 09 13:58:29 CST 2023, id=1183b0b84ee4f581bba001c47a78b2d9}], fd_3c460e6c6f0882=null, fd_3c460e71f46a90=null, fd_3c4555eddaf464_dataModelName=, fd_3c4555eddaf464_text=XS1507-04, fd_3c460e5693543e_record=[{data=检测, name=管理员, time=Mon Oct 09 13:58:29 CST 2023, id=1183b0b84ee4f581bba001c47a78b2d9}], fd_3c3ffcbd979d92=1, fd_3c460e57839744=1, fd_3c460e57f8e99c=1, fd_3c4555e6f071ce_dataFdId=, fd_3c460e5693543e=1, fd_3c4555e6f071ce=SOYP2310090002, fd_3c460dbdb47274_record=[{data=检测, name=管理员, time=Mon Oct 09 13:58:29 CST 2023, id=1183b0b84ee4f581bba001c47a78b2d9}], fd_3c460e6d3e8382=null, fd_3c4555e6f071ce_dataSourceId=, fd_3c4555eddaf464_dataSourceId=, fd_3c460e70fb65ac=null}]";
//        String jsonStr = "{appkey:zkkOpNJ1Jo,adtype:1,appid:33e496d5fec,deviceid:15d994b}";
                String jsonStr = "{\n" +
                        "\tfd_3c460e560fc7a8=0, fd_3c460e6bfc35b4=null, fd_3c460e6cca7ac6=null, \n" +
                        "\tfd_3c460e5706d522_record=[{data=不检测, name=管理员, time=Mon Oct 09 13:58:29 CST 2023, id=1183b0b84ee4f581bba001c47a78b2d9}], \n" +
                        "\tfd_3c4555eddaf464_selectedDatas=, fd_3c460e7171bed8=null, fd_3c460e7014c014=null, fd_3c4555eddaf464_dataFdId=, fd_3c460e5706d522=0, fd_3c4555e6f071ce_text=SOWL2107010001, fd_3c4555e6f071ce_selectedDatas=, fd_3c460e6f8c059c=null, \n" +
                        "\tfd_3c460e57839744_record=[{data=不检测, name=管理员, time=Mon Oct 09 13:58:29 CST 2023, id=1183b0b84ee4f581bba001c47a78b2d9}], \n" +
                        "\tfd_3c3ffcbd979d92_record=[{data=1, name=管理员, time=Mon Oct 09 13:58:29 CST 2023, id=1183b0b84ee4f581bba001c47a78b2d9}], \n" +
                        "\tfd_3c4555eddaf464=ibox, fd_3c460e6d98f1e0=null, fdId=18b1303fad1369311727cbb4cb892a25, fd_3c460e7088a848=null, fd_3c460e6e7e24ca=null, fd_3c3ffcbc4327b2=物联锁展示柜,组装好的,包含2个物联锁+1个有线控制器+2个数显触摸屏+四个阻尼铰链+1个拉手+其他配件+1套柜体, \n" +
                        "\tfd_3c460e57f8e99c_record=[{data=不检测, name=管理员, time=Mon Oct 09 13:58:29 CST 2023, id=1183b0b84ee4f581bba001c47a78b2d9}], \n" +
                        "\tfd_3c460dbdb47274=0, fd_3c460e560fc7a8_record=[{data=不检测, name=管理员, time=Mon Oct 09 13:58:29 CST 2023, id=1183b0b84ee4f581bba001c47a78b2d9}], \n" +
                        "\tfd_3c4555e6f071ce_dataModelName=, fd_3c460e6dff18b6=null, fd_3c460e6f095840=null, fd_3c3ffcbc4327b2_record=[{data=物联锁展示柜,组装好的,包含2个物联锁+1个有线控制器+2个数显触摸屏+四个阻尼铰链+1个拉手+其他配件+1套柜体, name=管理员, time=Mon Oct 09 13:58:29 CST 2023, id=1183b0b84ee4f581bba001c47a78b2d9}], \n" +
                        "\tfd_3c460e6c6f0882=null, fd_3c460e71f46a90=null, fd_3c4555eddaf464_dataModelName=, fd_3c4555eddaf464_text=ibox-1580, \n" +
                        "\tfd_3c460e5693543e_record=[{data=不检测, name=管理员, time=Mon Oct 09 13:58:29 CST 2023, id=1183b0b84ee4f581bba001c47a78b2d9}], \n" +
                        "\tfd_3c3ffcbd979d92=1, fd_3c460e57839744=0, fd_3c460e57f8e99c=0, fd_3c4555e6f071ce_dataFdId=, fd_3c460e5693543e=0, fd_3c4555e6f071ce=SOWL2107010001, \n" +
                        "\tfd_3c460dbdb47274_record=[{data=不检测, name=管理员, time=Mon Oct 09 13:58:29 CST 2023, id=1183b0b84ee4f581bba001c47a78b2d9}], \n" +
                        "\tfd_3c460e6d3e8382=null, fd_3c4555e6f071ce_dataSourceId=, fd_3c4555eddaf464_dataSourceId=, fd_3c460e70fb65ac=null\n" +
                        "\n" +
                        "\t}";
        String result = Arrays.stream(jsonStr.substring(1, jsonStr.length() - 1).split(","))
                .map(v -> "\"" + v.replaceFirst(":", "\":\"") + "\"")
                .reduce("{", (a, b) -> a + b + ",")
                .toString();
        result = result.substring(0, result.length() - 1) + "}";
        JSONObject js = JSONObject.fromObject(result);
        System.out.println(js);
    }

//    private static void test1() {
//        try {
//            String url = "http://192.168.50.242:2886/lockingRecords/locking/getRecords" + "?salNo=" + "1226"+ "?moder=" + "1518"+ "?orderNo=" + "SOWL2107010001";
//            HttpGet httpGet = new HttpGet(url);
//            CloseableHttpClient closeableHttpClient = HttpClients.createDefault();
//            CloseableHttpResponse execute = closeableHttpClient.execute(httpGet);
//            String resultStr = EntityUtils.toString(execute.getEntity(), "UTF-8");
//
//            JSONObject resultJson = JSONObject.parseObject(resultStr);
//            JSONArray rows1 = JSON.parseArray(resultJson.get("rows").toString());
//            List list = JSON.parseArray(resultJson.get("rows").toString());
//            list.clear();
//            Object rows = resultJson.get("rows");
//            System.out.println(resultJson.get("rows11"));
//            System.out.println(resultStr);
//            System.out.println(list);
//            Object a = new Object();
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//    }
}
